//
//  ML_TabBarController.m
//  07_23_HomeWork
//
//  Created by GivenBmli on 16/7/25.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "ML_TabBarController.h"
#import "ML_First.h"
#import "ML_Second.h"
#import "ML_Third.h"
#import "ML_Four.h"
#import "ML_Five.h"
@interface ML_TabBarController ()

@end

@implementation ML_TabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor cyanColor];
    
    [UINavigationBar appearance];
    // 通过appearance统一设置所有UITabBarItem的文字属性
    // 后面带有UI_APPEARANCE_SELECTOR的方法, 都可以通过appearance对象来统一设置
    ML_First *first = [[ML_First alloc] init];
    [self setChildVc:first title:@"df" image:@"" seleImage:@""];
    [self setChildVc:[[ML_Second alloc] init] title:@"fdf" image:nil seleImage:nil];
    [self setChildVc:[[ML_Third alloc] init] title:@"dfsf" image:nil seleImage:nil];
    [self setChildVc:[[ML_Four alloc] init] title:@"dfdssf" image:nil seleImage:nil];
    [self setChildVc:[[ML_Five alloc] init] title:@"dfsfdf" image:nil seleImage:nil];
}
- (void)setChildVc:(UIViewController *)childVc title:(NSString *)title image:(NSString *)image seleImage:(NSString *)seleImage {
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVc];
    childVc.navigationItem.title = title;
    nav.tabBarItem.title = title;
    childVc.tabBarItem.image = [UIImage imageNamed:image];
    childVc.tabBarItem.selectedImage = [UIImage imageNamed:seleImage];
    
    [nav.navigationBar setBarTintColor:[UIColor redColor]];
    [self addChildViewController:nav];
}





/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
